<!DOCTYPE html>
<html xmlns="">
<head>
    <meta charset="UTF-8">
    <title>${serverName}-修改用户密码</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${hostUrl}/static/layui/css/layui.css">
    <script type="text/javascript" src="${hostUrl}/static/layui/layui.js"></script>
    <script type="text/javascript" src="${hostUrl}/static/layui/custom/js/dickov.js" ></script>
    <script>

        layui.use('form', function(){
            var form = layui.form;

            //监听提交
            form.on('submit(formDemo)', function(data){
                var $ = layui.$;
                $.ajax({
                    type: 'post',
                    data: $('#userForm').serialize(),
                    url: '${hostUrl}/user/changePassword',
                    cache:false,
                    dataType:'json',
                    success: function (resp) {
                        layer.msg(resp.msg);
                        if(resp.code == 0){
                          alert(resp.msg);
                          parent.location.reload();
                        }
                    }
                })
                return false;
            });

        });
    </script>
</head>
<body>
<!-- 强行添加两行，避免Form太过靠上了 -->
<br/><br/>

<form class="layui-form" id="userForm" method="post" action="/">
    <input type="hidden" name="userId" value="${loginUser.userId}">

    <div class="layui-form-item">
        <label class="layui-form-label">新密码：</label>
        <div class="layui-input-inline">
            <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
    </div>

<#--    <div class="layui-form-item">-->
<#--        <label class="layui-form-label">再次输入新密码：</label>-->
<#--        <div class="layui-input-inline">-->
<#--            <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">-->
<#--        </div>-->
<#--    </div>-->

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">确定修改</button>
        </div>
    </div>

</form>
</body>
</html>